/*
 * CoreFunctions.cpp
 *
 *  Created on: 2010/09/01
 *      Author: alexandre
 */

#include "CoreFunctions.h"
#include "ScriptManager.h"

QScriptValue importExtension(QScriptContext* rContext,
		QScriptEngine* rEngine) {

	return ScriptManager::import(rContext->argument(0).toString(),rEngine );
}

QScriptValue loadScripts(QScriptContext* rContext, QScriptEngine* rEngine) {

    for (int i = 0; i < rContext->argumentCount(); ++i) {

		QString fileName = rContext->argument(0).toString();

		bool result = ScriptManager::load( fileName, rEngine );

		if ( !result )
			return rEngine->undefinedValue();
	}

	return rEngine->undefinedValue();
}
